differentiation from first principles